import { object_Inf } from "@/utils/typings/index.type";
import request from "@/utils/request";
import equipSpare_APi from "../equipSpare";
/*
 * @Descripttion:设备保养接口类
 * @LastEditors: xzh
 * @LastEditTime: 2023-11-12 22:03:02
 */
export default class equipUpkeep_APi extends equipSpare_APi {
  //#region 设备保养项目
  /**
   * @Author: xzh
   * @Descripttion:保存设备保养项目信息
   * @Param:
   * @param {object} data
   */
  static saveEquipUpkeepItem = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceProject/SaveMaintenanceProject",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备保养项目信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipUpkeepItem = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceProject/DeleteMaintenanceProject",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改设备保养项目状态
   * @Param:
   * @param {Array} data
   */
  static updateEquipUpkeepItemStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceProject/UpdateMaintenanceProjectStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备保养项目信息
   * @Param:
   * @param {number} id 设备保养项目主键
   */
  static getEquipUpkeepItemInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceProject/GetMaintenanceProject",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备保养项目列表
   * @Param:
   */
  static getEquipUpkeepItemList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceProject/GetMaintenanceProjectList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 根据保养计划获取保养项目
   * @Param:
   * @param {number} planId 设备保养计划主键
   */
  static getEquipUpkeepItemByPlan = (
    planId: number
  ): Promise<Array<object_Inf>> =>
    request({
      url: "/api/MaintenanceProject/GetMaintenanceProjectListByPlanId",
      method: "get",
      params: { planId },
    });
  //#endregion

  //#region 设备保养计划
  /**
   * @Author: xzh
   * @Descripttion:保存设备保养计划信息
   * @Param:
   * @param {object} data
   */
  static saveEquipUpkeepPlan = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/MaintenancePlan/SaveMaintenancePlan",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备保养计划信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipUpkeepPlan = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/MaintenancePlan/DeleteMaintenancePlan",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备保养计划信息
   * @Param:
   * @param {number} id 设备保养计划主键
   */
  static getEquipUpkeepPlanInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/MaintenancePlan/GetMaintenancePlan",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备保养计划列表
   * @Param:
   */
  static getEquipUpkeepPlanPageList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/MaintenancePlan/GetMaintenancePlanList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  //#endregion

  //#region 设备保养记录
  /**
   * @Author: xzh
   * @Descripttion:保存设备保养记录信息
   * @Param:
   * @param {object} data
   */
  static saveEquipUpkeepRecord = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceRecord/SaveMaintenanceRecord",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备保养记录信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipUpkeepRecord = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceRecord/DeleteMaintenanceRecord",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备保养记录信息
   * @Param:
   * @param {number} id 设备保养记录主键
   */
  static getEquipUpkeepRecordInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceRecord/GetMaintenanceRecord",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备保养记录列表
   * @Param:
   */
  static getEquipUpkeepRecordList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/MaintenanceRecord/GetMaintenanceRecordList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  //#endregion
}
